//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<css_parser.h>
///	@path	~/src/database/xres/
///	@date	2008/11/02
///	@desc	.

#pragma once

#include "xeres.h"

#include "object/IBuffer.h"
#include "object/varying_data.h"

#include "database/database.h"
#include "database/store/IFile.h"
#include "database/store/cached_file.h"

namespace xeres {

	/*! 
		\class	CssParser
		\brief	A simple CSS style sheet parser.
	*/
	class CssParser
	{
	public:

		/// \ctor
		CssParser( void );

		/// \dtor
		virtual ~CssParser( void );

	//@ interface

		/// \brief	On selector begin.
		virtual void OnSelectorBegin( void ) = 0;

		/// \brief	On selector end.
		virtual void OnSelectorEnd( void ) = 0;

		/// \brief	On style property.
		virtual void OnProperty( const WString& property , RefWeak<IVar> var );

	//@ local

		/*!
			\brief		Parse CSS from a file.
		*/
		bool ParseFile( RefWeak<IFile> file );

		/*!
			\brief		Parse CSS from a string.
		*/
		bool ParseString( const byte * data );

	private:

	};
	
} // namespace xeres
